package com.cn.cloudalibaba.controller;

import com.cn.cloud.entities.CommonResult;
import com.cn.cloud.entities.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @Value("${service-url.nacos-user-service}")
    private String SERVICEURL;


    //http://localhost:83/nacos/consumer/payment/get/1
    @GetMapping("/nacos/consumer/payment/get/{id}")
    public String getPaymentById(@PathVariable("id") Integer id) {
        return restTemplate.getForObject(SERVICEURL + "/nacos/payment/" + id, String.class, id);
    }
}
